require 'watir'
include Watir
require 'test/unit'
class TC_blogsFrontEnd < Test::Unit::TestCase
  	def test_40_ModifyBlogUsingButtons_Blogs

    $ie.goto($UniVar)

      #No Prerequisites required
      #test specifics
      $ie.goto($UniVar + '/controlpanel/BlogAdmin/Groups.aspx')
      	$ie.link(:text, 'Add New Group').click
      $ie.frame(:index, 1).text_field(:id, /GroupName$/).value = 'Some name'
      $ie.frame(:index, 1).text_field(:id, /GroupDesc$/).value = 'Some description'
      $ie.frame(:index, 1).link(:id, /SaveButton$/).click

      $ie.div(:index, 61).click
      $ie.div(:index, 61).click      
      $ie.link(:text, 'Edit').click
      $ie.frame(:index, 1).text_field(:id, /GroupName$/).clear
      $ie.frame(:index, 1).text_field(:id, /GroupName$/).value = 'changing group name for the second time'
      $ie.frame(:index, 1).text_field(:id, /GroupDesc$/).clear
      $ie.frame(:index, 1).text_field(:id, /GroupDesc$/).value = 'changing group description'      
      $ie.frame(:index, 1).link(:id, /SaveButton$/).click
      assert($ie.contains_text('changing group name for the second time'))

      $ie.div(:index, 61).click
      $ie.div(:index, 61).click
      $ie.link(:text, 'Delete').click_no_wait
      hwnd = $ie.enabled_popup(20)
        if(hwnd)
          w = WinClicker.new
          w.clickWindowsButton_hwnd(hwnd, "OK")
        end         
	end
end